package oceanlife;

public class AgentRelation implements Comparable<AgentRelation> {
	private Agent agent;
	private Agent relation;
	private Double angle;
	private Double distance;
	
	private Double ellipseBoost;
	
	public Double getEllipseBoost() {
		return ellipseBoost;
	}

	public AgentRelation(Agent agent, Agent relation, Double angle,Double ellipseBoost){
		this.agent = agent;
		this.relation = relation;
		this.angle = angle;
		this.ellipseBoost = ellipseBoost;
		
		distance = agent.getPosition().distanceTo(relation.getPosition());
	}
	
	public Double getMinAngle(){
		return angle-Math.tan(agent.getRadius()/distance);
	}

	public Double getMaxAngle(){
		return angle+Math.tan(agent.getRadius()/distance);
	}
	
	public Agent getAgent() {
		return agent;
	}

	public Agent getRelation() {
		return relation;
	}

	public Double getDistance(){
		return distance;
	}
	
	@Override
	public int compareTo(AgentRelation other) {
		return this.distance.compareTo(((AgentRelation)other).distance);
	}
	
	/*@Override
	public boolean equals(Object other){
		if(other instanceof AgentRelation && this.agent.equals(((AgentRelation)other).agent)
				&& this.relation.equals(((AgentRelation)other).relation) && this.distance.equals(((AgentRelation)other).distance)){
			return true;
		} else {
			return false;
		}
	}*/
	
}
